package com.lucas;

import com.lucas.Handler.UserServerHandler;
import com.lucas.Service.UserServiceImpl;
import com.lucas.service.UserService;
import org.I0Itec.zkclient.ZkClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;


@SpringBootApplication
@EnableAspectJAutoProxy
public class bootStrap {
    public static void main(String[] args) throws InterruptedException {
        int port = 8099;
        if(args.length>0){
            port  = Integer.valueOf(args[0]);
        }
        //服务器启动
        final ConfigurableApplicationContext run = SpringApplication.run(bootStrap.class, args);
        final UserServerHandler handler = run.getBean(UserServerHandler.class);
        UserServiceImpl bean = run.getBean(UserServiceImpl.class);
        bean.startServer(handler,port);
        System.out.println("服务器启动了");

    }
}
